package com.skyolder.milkbee.domain;

import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import groovy.util.ObjectGraphBuilder.DefaultNewInstanceResolver;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * Forum 论坛
 * title 论坛名字
 * description 论坛描述
 * keywords 关键字
 * logo 论坛logo
 */
@ApiModel(description = "Forum 论坛 title 论坛名字 description 论坛描述 keywords 关键字 logo 论坛logo")
@Entity
@Table(name = "forum")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Forum implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "title")
    private String title;

    @Column(name = "description")
    private String description;

    @Column(name = "keywords")
    private String keywords;

    @Column(name = "logo")
    private String logo;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public Forum title(String title) {
        this.title = title;
        return this;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public Forum description(String description) {
        this.description = description;
        return this;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getKeywords() {
        return keywords;
    }

    public Forum keywords(String keywords) {
        this.keywords = keywords;
        return this;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public String getLogo() {
        return logo;
    }

    public Forum logo(String logo) {
        this.logo = logo;
        return this;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Forum forum = (Forum) o;
        if (forum.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, forum.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Forum{" +
            "id=" + id +
            ", title='" + title + "'" +
            ", description='" + description + "'" +
            ", keywords='" + keywords + "'" +
            ", logo='" + logo + "'" +
            '}';
    }
    public static Forum defaultNewInstance(){
    	Forum forum=new Forum();
    	forum.setDescription("奶蜂论坛系统V1.0 作者QQ：1047181028,版权所有，请勿盗版！");
    	forum.setKeywords("奶蜂,BBS,论坛");
    	forum.setLogo("");
    	forum.setTitle("奶蜂论坛系统");
    	return forum;
    }
}
